Hi, |
Re: get the outgoing link path and paste it in a new attribute Object o Link l Module m = current ModName_ mod string s for o in m do { for l in o ->"*" do { mod= target(l) s= fullName(mod) o."link path""" = s } } |
Re: get the outgoing link path and paste it in a new attribute ashokanumula - Thu Feb 23 07:50:03 EST 2012 Thanks! I tried with the following script which is similar to yours, and its working. (it picks the name and puts in a new attribute). One problem i face is, it picks only the last link path not all the path. i.e If the object has 3 links, this script copies only the third link path and pastes. Any suggestion to sort it out? Object o = null LinkRef lref ModName_ srcModRef for o in current do { if(!null o) { for lref in o<-"*" do { srcModRef = source lref o."link path" = fullName(srcModRef) } } } Thanks. |
Re: get the outgoing link path and paste it in a new attribute AshokNandha - Thu Feb 23 08:34:33 EST 2012 While looping for the next object, reset the dummy string variable. This should solve the problem. |
Re: get the outgoing link path and paste it in a new attribute Lion29 - Thu Feb 23 09:57:09 EST 2012 |
Re: get the outgoing link path and paste it in a new attribute General
"Link" information is stored in the module sourcing the link. So you can always see outgoing links of an object. But you can only see incoming "Link"s when the other Source module is open. When DXL deals with incoming links you need to first make sure those other modules are open.'
We see a simple script to pre-open those modules.
Although I advise routinely opening the standard view of that module rather than the default view:
The above code should be routine before dealing with incoming links:
Specific
If you just want a list of every module that has links incoming to the current object and don't care which source objects they are nor how many there are, then you really don't need to pre-open those modules since you don't actually need to look at the "Link" and the name is already available.
ModName_ srcModRef
Skip skpSources = createString() // KEY and DATA both 'string' name of source module
Buffer bufSources = create()
for srcModRef in o<-"*" do
{ put(skpSources, fullName(srcModRef), fullName(srcModRef))
}
string SourceName
for SourceName in skpSources do
{ if (length(bufSources) != 0) bufSources += "\n" // EOL after previous Name
bufSources += SourceName
}
o."LinkPath" = bufSources
delete(bufSources)
delete(skpSources)
Results is 1000 "A"s but wasted memory space explodes I think in this case 500,000 characters.
|
Re: get the outgoing link path and paste it in a new attribute llandale - Thu Feb 23 14:32:38 EST 2012 General
"Link" information is stored in the module sourcing the link. So you can always see outgoing links of an object. But you can only see incoming "Link"s when the other Source module is open. When DXL deals with incoming links you need to first make sure those other modules are open.'
We see a simple script to pre-open those modules.
Although I advise routinely opening the standard view of that module rather than the default view:
The above code should be routine before dealing with incoming links:
Specific
If you just want a list of every module that has links incoming to the current object and don't care which source objects they are nor how many there are, then you really don't need to pre-open those modules since you don't actually need to look at the "Link" and the name is already available.
ModName_ srcModRef
Skip skpSources = createString() // KEY and DATA both 'string' name of source module
Buffer bufSources = create()
for srcModRef in o<-"*" do
{ put(skpSources, fullName(srcModRef), fullName(srcModRef))
}
string SourceName
for SourceName in skpSources do
{ if (length(bufSources) != 0) bufSources += "\n" // EOL after previous Name
bufSources += SourceName
}
o."LinkPath" = bufSources
delete(bufSources)
delete(skpSources)
Results is 1000 "A"s but wasted memory space explodes I think in this case 500,000 characters.
|
Re: get the outgoing link path and paste it in a new attribute AshokNandha - Fri Feb 24 10:43:20 EST 2012 Object o = current ModName_ srcModRef for o in current do { Skip skpSources = createString() // KEY and DATA both 'string' name of source module Buffer bufSources = create() for srcModRef in o<-"*" do { put(skpSources, name(srcModRef), name(srcModRef)) } string SourceName for SourceName in skpSources do { if (length(bufSources) != 0) bufSources += ", \n" // EOL after previous Name bufSources += SourceName } o."link" = bufSources delete(bufSources) delete(skpSources) } Thanks again for the explanation. |
Re: get the outgoing link path and paste it in a new attribute AshokNandha - Fri Feb 24 11:06:01 EST 2012 You don't need to set "o" to current. You do need to be mindful of which "Module" is current as sometimes it changes unpredicably. Perhaps use these as the first few lines: Object o ModName_ srcModRef Module mod = current print "Setting source references for module: '" name(mod) "'...\n" for o in mod do
for o in entire mod do
{ if (isDeleted(o)) continue
if (for some other reason I want to ignore o) continue
proceed to deal with o
}
|